#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
using namespace std;

class Date
{
public:
    Date(int year = 1900, int month = 1, int day = 1)
    {
        if (year >= 1000 && year <= 9999)
        {
            _year = year;
            _month = month;
            _day = day;
        }
    }
    int getday()
    {
        int monthday[13] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 };
        int ret = 0;
        int i = 1;
        while (i < _month)
        {
            ret += monthday[i];
            ++i;
        }
        ret += _day;
        if ((_year % 4 == 0 && _year % 100 != 0) || (_year % 400 == 0))
        {
            if (i > 2)
            {
                ret += 1;
            }
        }
        return ret;
    }
private:
    int _year;
    int _month;
    int _day;
};
int main()
{
    int year, month, day;
    cin >> year >> month >> day;
    Date d(year, month, day);
    cout << d.getday() << endl;
    return 0;
}

//class Add
//{
//public:
//    Add()
//    {
//        sum += ret;
//        ++ret;
//    }
//    static int ret;
//    static int sum;
//};
//int Add::ret = 1;
//int Add::sum = 0;
//class Solution
//{
//public:
//
//    int Sum_Solution(int n)
//    {
//        Add s[n];
//        return Add::sum;
//    }
//};